/* This file was generated with JastAdd2 (http://jastadd.org) version R20121112 (r872) */
package parser;

import icode.*;
import util.*;
import semanticlib.SymbolTable;
/**
 * @production IdDecl : {@link Id};
 * @ast node
 * @declaredat /h/d6/h/int12psh/workspace/CalcCode/specification/MiniP.ast:22
 */
public class IdDecl extends Id implements Cloneable {
  /**
   * @apilevel low-level
   */
  public void flushCache() {
    super.flushCache();
  }
  /**
   * @apilevel internal
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public IdDecl clone() throws CloneNotSupportedException {
    IdDecl node = (IdDecl)super.clone();
    return node;
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public IdDecl copy() {
      try {
        IdDecl node = (IdDecl)clone();
        if(children != null) node.children = (ASTNode[])children.clone();
        return node;
      } catch (CloneNotSupportedException e) {
      }
      System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
      return null;
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   */
  @SuppressWarnings({"unchecked", "cast"})
  public IdDecl fullCopy() {
    try {
      IdDecl tree = (IdDecl) clone();
      tree.setParent(null);// make dangling
      if (children != null) {
        tree.children = new ASTNode[children.length];
        for (int i = 0; i < children.length; ++i) {
          if (children[i] == null) {
            tree.children[i] = null;
          } else {
            tree.children[i] = ((ASTNode) children[i]).fullCopy();
            ((ASTNode) tree.children[i]).setParent(tree);
          }
        }
      }
      return tree;
    } catch (CloneNotSupportedException e) {
      throw new Error("Error: clone not supported for " +
        getClass().getName());
    }
  }
  /**
   * @ast method 
   * @aspect Generator
   * @declaredat /h/d6/h/int12psh/workspace/CalcCode/specification/ICodeGenerator.jadd:72
   */
  Variable genVariable() {
	return new Variable(index, 0);
    }
  /**
   * @ast method 
   * @aspect NameAnalysis
   * @declaredat /h/d6/h/int12psh/workspace/CalcCode/specification/NameAnalysis.jadd:54
   */
  void addDecl(SymbolTable table) {
		table.add(getID(), this);
	}
  /**
   * @ast method 
   * @aspect VarNumbering
   * @declaredat /h/d6/h/int12psh/workspace/CalcCode/specification/VarNumbering.jadd:8
   */
  
	public int index;
  /**
   * @ast method 
   * @aspect VarNumbering
   * @declaredat /h/d6/h/int12psh/workspace/CalcCode/specification/VarNumbering.jadd:29
   */
  int numbering(Integer varCount){
		this.index = varCount;
		varCount ++;
		return varCount;
	}
  /**
   * @ast method 
   * 
   */
  public IdDecl(int i) {
    super(i);
  }
  /**
   * @ast method 
   * 
   */
  public IdDecl(MiniP p, int i) {
    this(i);
    parser = p;
  }
  /**
   * @ast method 
   * 
   */
  public IdDecl() {
    this(0);


  }
  /**
   * @ast method 
   * 
   */
  public IdDecl(String p0) {
    setID(p0);
  }
  /**
   * @ast method 
   * 
   */
  public void dumpTree(String indent, java.io.PrintStream pStream) {
    pStream.println(indent + "IdDecl"+ "\"" + getID() + "\"");
        String childIndent = indent + "  ";
    for(int i = 0; i < getNumChild(); i++)
      getChild(i).dumpTree(childIndent, pStream);
  }
  /**
   * @ast method 
   * 
   */
  public Object jjtAccept(MiniPVisitor visitor, Object data) {
    return visitor.visit(this, data);
  }
  /**
   * @ast method 
   * 
   */
  public void jjtAddChild(Node n, int i) {
    checkChild(n, i);
    super.jjtAddChild(n, i);
}
  /**
   * @ast method 
   * 
   */
  public void checkChild(Node n, int i) {
  }
  /**
   * @apilevel low-level
   * @ast method 
   * 
   */
  public int getNumChild() {
    return 0;
  }
  /**
   * Replaces the lexeme ID.
   * @param value The new value for the lexeme ID.
   * @apilevel high-level
   * @ast method 
   * 
   */
  public void setID(String value) {
    tokenString_ID = value;
  }
  /**
   * Retrieves the value for the lexeme ID.
   * @return The value for the lexeme ID.
   * @apilevel high-level
   * @ast method 
   * 
   */
  public String getID() {
    return tokenString_ID != null ? tokenString_ID : "";
  }
}
